package com;

import com.model.AcmeProperties6;
import com.model.Bee1;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 软注入-构造方式的传播性
 * 如果@EnableConfigurationProperties(AcmeProperties5.class)被注释，启动报错
 */
@RestController
@EnableConfigurationProperties(AcmeProperties6.class)
public class EnabelConfigInnerSpread2Controller {

    @Configuration
    class Test {
        @Bean
        public Bee1 bee1(AcmeProperties6 acmeProperties6) {
            System.out.println(acmeProperties6);
            return new Bee1();
        }
    }

    @RequestMapping("acme6")
    public String acme6(AcmeProperties6 acmeProperties6) {
        System.out.println(acmeProperties6);
        return "acme6";
    }
}
